package com.ljc.im.handler;

import com.ljc.common.lang.Consts;
import com.ljc.im.handler.impl.ChatMsgHandler;
import com.ljc.im.handler.impl.PingMsgHandler;
import lombok.extern.slf4j.Slf4j;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author: ljc
 * @Date:Created in 9:36 2022/2/25
 */
@Slf4j
public class MsgHandlerFactory {
    private  static Map<String,MsgHandler> handlerMap=new HashMap<>();
   public static void init(){

       handlerMap.put(Consts.IM_MESS_TYPE_CHAT,new ChatMsgHandler());
       handlerMap.put(Consts.IM_MESS_TYPE_PING,new PingMsgHandler());
       log.info("MsgHandlerFactory>>>>>init");
   }
   public static  MsgHandler getMsgHandler(String type){
    return handlerMap.get(type);
   }
}
